<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 改变构造函数的原型不叫继承，原型继承

        function User(){}
        User.prototype.name = function(){
            console.log(this,'user name');
        }
        let u = new User();
        u.name();
        function Admin(){}
        Admin.prototype.__proto__ = User.prototype;
        Admin.prototype.role = function(){
            console.log(this,'admin role')
        }
        let a = new Admin();
        a.name();
        a.role();


        function Member(){}
        Member.prototype.__proto__ = User.prototype;
        Member.prototype.role = function(){
            console.log(this,'member role')
        }
        let m = new Member();
        m.name();
        m.role();

    </script>
</body>
</html>